<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once('src/facebook.php');
require_once('community.php');

class Planetjazz extends Community {

	public function __construct()
	{
		//call on community constructor
		parent::__construct('planetjazz');								
		//increments for archive calls
		$this->ajax_increment = 4;
	}
	
	public function index($modal = null)
	{
		if($this->community->enumDisabled == 'disabled')
        {    
            echo "<h1>Under Construction</h1>";
            //$this->load->view('disabled_content',$this->data);
        }
        else
        {    
			$this->load->model('data_fetcher');
			//get content---------------------------------------------------
			//first we get all content types		
			$content_types = $this->community_model->fetch_content_types();
			foreach($content_types as $ctype)
			{
				$content[$ctype['strName']] = $this->community_model->fetch_content($ctype['intID'],$this->community->intID);
				$content[$ctype['strName'].'_count'] = $this->feeds->get_feed_count($this->community->intID,$ctype['intID']);
			}
            $video = $this->community_model->get_featured_video(get_type_id('show'),$this->community->intID);
             if(!empty($video))
                $this->data['video'] = $video;
			$this->data['modal_trigger'] = $modal;
			$this->data['content'] = $content;				
			$this->load->view('header',$this->data);
			$this->load->view('content',$this->data);
			$this->load->view('footer',$this->data);
		}
	}
	
    public function ads($adspaceName)
	{
	
        $this->load->model('data_fetcher');
        $this->data['ad'] = $this->data_fetcher->get_random_ad($adspaceName,null);
        
        //print_r($this->data['ad']);
        //print_r($this->data['ad']);
        if($this->data['ad'] == 'default.jpg')
            echo "No Namespace";
        else
            $this->load->view('ad_view',$this->data);
		
	}	
	
}

